home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / batch / library / dvscr10 / dvscr.btm next >
Text File  |  1992-03-24  |  2KB  |  72 lines

  1. echo off
  2. echo DVScr - batch to control convscr using 4dos
  3. echo By Yaniv Golan    All Rights Reserved    March 92.
  4. echo.
  5. rem check flags :
  6. iff "%1" == "/?" then
  7.   echo Usage :    DVSCR options filename
  8.   echo options :  /s  convert script file (.dvs) to text file (.txt)
  9.   echo            /t  convert text file (.txt) to script file (.scr)
  10.   echo filename : if the file name is 2 characters long it is first
  11.   echo            assumed to be of the form xx-scrip.[dvs\txt]. if
  12.   echo            such file cannot be found, or if the length of the
  13.   echo            name is more then two characters, the filename is
  14.   echo            treated as a fully qualified name, with an extension
  15.   echo            according to the options setting.
  16.   echo.
  17.   echo bugs, comments etc. to Yaniv Golan s2942275@techst02.technion.ac.il
  18.   echo.
  19.   goto end
  20. endiff
  21. rem if number of parameters ins't 2, and 1st one isn't /?, then it
  22. rem is a error :
  23. iff %# LT 2 then
  24.   echo Missing parameters. Type DVSCR /? for help.
  25.   goto end
  26. endiff
  27. rem .txt to .dvs :
  28. iff %@lower[%1]==/t then
  29.   set dvs_src_ext=txt
  30.   set dvs_dst_ext=dvs
  31.   set dvs_kbd_str="t"
  32. else
  33.   rem .dvs to .txt :
  34.   iff %@lower[%1]==/s then
  35.     set dvs_src_ext=dvs
  36.     set dvs_dst_ext=txt
  37.     set dvs_kbd_str="s"
  38.   else
  39.     rem 1st parameter wasn't /t or /s, so it's a error.
  40.     echo Incorrect option specified. type DVSCR /? for help.
  41.     goto end
  42.   endiff
  43. endiff
  44. rem if 2nd param is only 2 chars, try to see if it's xx-scrip.???
  45. iff %@len[%2] == 2 then
  46.   set dvs_src_name=%2-scrip.%dvs_src_ext
  47.   set dvs_dst_name=%2-scrip.%dvs_dst_ext
  48.   if it isn't, try to see  maybe it is xx.???
  49.   if not exist %dvs_src_name goto long_name
  50. else
  51. if 2nd param is longer then 2 chars, or if the 2 chars version doesn't exist :
  52. :long_name
  53.   set dvs_src_name=%2.%dvs_src_ext
  54.   set dvs_dst_name=%2.%dvs_dst_ext
  55.   rem if this too fails, then the file doesn't exit.
  56.   iff not exist %dvs_src_name then
  57.     echo File doesn't exist.
  58.     goto end
  59.   endiff
  60. endiff
  61. rem make the string which will be pushed to the kbd buffer:
  62. set dvs_kbd_str=%dvs_kbd_str 13 "%dvs_src_name" 13 "%dvs_dst_name" 13 "x" 13
  63. rem push the string
  64. keystack %dvs_kbd_str
  65. rem ... and run convscr.
  66. convscr > nul
  67. iff %? != 0 then
  68.   echo An error was encountered during conversion.
  69. else
  70.   echo Done.
  71. :end
  72.